home *** CD-ROM | disk | FTP | other *** search
/ Super PC 31 / Super PC 31 (Shareware).iso / spc / inter / speakf / fuente / netfone.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-12-01  |  23.5 KB  |  633 lines

  1. /*
  2.  
  3.             Master include file
  4.             
  5. */
  6.  
  7. //  System include files
  8.  
  9. #include <windows.h>
  10. #include <shellapi.h>
  11. #define _INC_SHELLAPI
  12. #include <windowsx.h>
  13. #include <winsock.h>
  14. #include <mmsystem.h>
  15.  
  16. #ifndef RC_INVOKED
  17.  
  18. #include <stdarg.h>
  19. #include <stdio.h>
  20. #include <stdlib.h>
  21. #include <string.h>
  22. #include <ctype.h>
  23. #include <memory.h>
  24. #include <time.h>
  25. #include <float.h>
  26. #include <io.h>
  27. #include <commdlg.h>
  28.  
  29. //    Application include files
  30.  
  31. #include "md5.h"
  32. #include "des.h"
  33. #include "idea.h"
  34. #include "ulaw.h"
  35. #include "gsm.h"
  36. #include "adpcm_u.h"
  37. #include "rtp.h"
  38. #include "lpc.h"
  39.  
  40. #endif
  41.  
  42. #include "resource.h"
  43.  
  44. //  Socket used to exchange sound packets
  45.  
  46. #define NETFONE_COMMAND_PORT           2074
  47. //#define NETFONE_COMMAND_PORT           3456                // For testing only
  48.  
  49. //    If defined, show rant about serial I/O on comm errors
  50.  
  51. #define RANT_ON_ERROR
  52.  
  53. //  Maximum length (in characters) of a host name
  54.  
  55. #define MAX_HOST                        256
  56.  
  57. //  Get/SetWindowLong offsets
  58.  
  59. #define GWL_CLIENT                      0               // Client-side data
  60.  
  61. //  Type fields for client/server window data structures
  62.  
  63. #define WINDOW_TYPE_CLIENT              1
  64.  
  65. //  Various timeouts in seconds
  66.  
  67. #define FRAME_TIMER_ID                  1
  68.  
  69. #define TIMEOUT_CONNECTION                30                // Remote connection timeout
  70. #define TIMEOUT_AUDIO_OUTPUT            10                // Release audio output timeout
  71. #define TIMEOUT_RESEND_LWL                (60 * 2)        // Resend Look Who's Listening listing
  72. #define BroadcastUnsubscribe            10                // Broadcast mike blip length (seconds) 
  73.  
  74. //  Maximum printf-like output allowed by MsgBox
  75.  
  76. #define MAX_PRINTF_OUTPUT               1024
  77.  
  78. //    Number of recent connections to remember
  79.  
  80. #define REMEMBER_CONNECTIONS    5
  81.  
  82. //    Multicast definitions missing from WINSOCK.H
  83.  
  84. #ifndef IN_MULTICAST
  85. #define IN_MULTICAST(i) ((ntohl((long)(i)) & 0xF0000000) == 0xE0000000)
  86. #endif
  87.  
  88. //  Messages posted by the asynchronous socket APIs
  89.  
  90. #define WM_SOCKET_SELECT    (WM_USER + 100)
  91. #define WM_SOCKET_ASYNC        (WM_USER + 101)
  92. #define WM_SOCKET_LWL        (WM_USER + 102)        // LWL socket notifications
  93.  
  94. /* void Cls_OnSocketSelect(HWND hwnd, SOCKET sock, SOCKERR serr,
  95.                            SOCKEVENT sevent) */
  96. #define HANDLE_WM_SOCKET_SELECT(hwnd, wParam, lParam, fn) \
  97.     ((fn)((hwnd), (SOCKET)(wParam), (SOCKERR)WSAGETSELECTERROR(lParam), \
  98.     (SOCKEVENT)WSAGETSELECTEVENT(lParam)), 0L)
  99. #define FORWARD_WM_SOCKET_SELECT(hwnd, socket, serr, sevent, fn) \
  100.     (void)(fn)((hwnd), WM_SOCKET_SELECT, (WPARAM)(socket), \
  101.     (LPARAM)WSAMAKESELECTREPLY(sevent, serr))
  102.  
  103. /* void Cls_OnSocketAsync(HWND hwnd, HANDLE hAsync, SOCKERR serr,
  104.                           WORD cbBuffer) */
  105. #define HANDLE_WM_SOCKET_ASYNC(hwnd, wParam, lParam, fn) \
  106.     ((fn)((hwnd), (HANDLE)(wParam), (SOCKERR)WSAGETASYNCERROR(lParam), \
  107.     (WORD)WSAGETASYNCBUFLEN(lParam)), 0L)
  108. #define FORWARD_WM_GETXBYX(hwnd, hAsync, serr, cbBuffer, fn) \
  109.     (void)(fn)((hwnd), WM_SOCKET_ASYNC, (WPARAM)(hAsync), \
  110.     (LPARAM)WSAMAKEASYNCREPLY(cbBuffer, serr))
  111.  
  112. //  Some useful constants missing from 16-bit Windows
  113.  
  114. #ifndef WIN32
  115. #define MAX_PATH    260             // characters
  116. #endif
  117.  
  118. //  Determine number of elements in an array
  119.  
  120. #define ELEMENTS(array) (sizeof(array)/sizeof((array)[0]))
  121.  
  122. //    Macro for retrieving formats from the resource file
  123.  
  124. #define Format(n)   rstring(IDS_FORMATS + (n))
  125.  
  126. /*    Force a resource string to be FAR for those (like wsprintf)
  127.     who can't figure out by themselves.  */
  128.     
  129. #define Lrstring(n)    ((LPSTR) rstring(n))
  130.  
  131. //  Make life with RC a little easier
  132.  
  133. #ifdef RC_INVOKED
  134. #define ID(x)           x
  135. #else
  136. #define ID(x)           MAKEINTRESOURCE(x)
  137. #endif
  138.  
  139. ///    Resource IDs
  140.  
  141. #define IDI_BASE                        1000
  142. #define IDM_BASE                        2000
  143. #define IDD_BASE                        3000
  144. #define IDA_BASE                        4000
  145.  
  146. //  Icon resource IDs
  147.  
  148. #define IDI_FRAME                       ID(1000)        // IDI_BASE + 0
  149. #define IDI_CLIENT                      ID(1001)        // IDI_BASE + 1
  150. #define IDI_SERVER                      ID(1002)        // IDI_BASE + 2
  151.  
  152. //  Menu resource IDs
  153.  
  154. #define IDM_FRAME_BASE                  2000            // IDM_BASE + 0
  155. #define IDM_FRAME                       ID(IDM_FRAME_BASE)
  156. #define IDM_CONNECTION_BASE             (IDM_FRAME_BASE + 0)
  157. #define IDM_CONNECTION_EXIT             (IDM_CONNECTION_BASE + 3)
  158.  
  159. #define IDM_WINDOW_BASE                 (IDM_FRAME_BASE + 100)
  160. #define IDM_WINDOW_CASCADE              (IDM_WINDOW_BASE + 0)
  161. #define IDM_WINDOW_TILE_VERTICALLY      (IDM_WINDOW_BASE + 1)
  162. #define IDM_WINDOW_TILE_HORIZONTALLY    (IDM_WINDOW_BASE + 2)
  163. #define IDM_WINDOW_ARRANGE_ICONS        (IDM_WINDOW_BASE + 3)
  164. #define IDM_WINDOW_FIRST_CHILD          (IDM_WINDOW_BASE + 4)
  165.  
  166. #define IDM_HELP_BASE                   (IDM_FRAME_BASE + 200)
  167. #define IDM_HELP_ABOUT                  (IDM_HELP_BASE + 0)
  168.  
  169. #define IDM_CUSTOM                        9000            // Custom (remembered file) menu items
  170.  
  171. //  Dialog resource IDs
  172.  
  173. #define IDD_ABOUT                       ID(3000)        // IDD_BASE + 0
  174.  
  175. #define IDD_NEW                         ID(3100)        // IDD_BASE + 100
  176. #define IDD_NEW_HOST                    3101
  177. #define IDD_NEW_HOST_LABEL              3102
  178.  
  179. //  Accelerator table resource IDs
  180.  
  181. #define IDA_FRAME    ID(4000)            // IDA_BASE + 0
  182.  
  183. #define BUFL    3200                    // Sound buffer maximum length (actually less)
  184.  
  185. #define LONG    long
  186.  
  187. struct soundbuf {
  188.     LONG compression;
  189.     char sendinghost[16];
  190.     struct {
  191.         LONG buffer_len;
  192.         char buffer_val[BUFL];
  193.     } buffer;
  194. };
  195. typedef struct soundbuf soundbuf;
  196.  
  197. // Packet mode flags
  198.  
  199. #define fComp2X     1              // Simple 2 to 1 compression
  200. #define fDebug        2              // Debug mode
  201. #define fSetDest    4              // Set sound output destination
  202. #define fDestSpkr   0              // Destination: speaker
  203. #define fDestJack   8              // Destination: audio output jack
  204. #define fLoopBack   16              // Loopback packets for testing
  205. #define fCompGSM    32              // GSM compression
  206. #define fEncDES     64              // DES encrypted
  207. #define fEncOTP     128           // One-time pad encrypted
  208. #define fEncIDEA    256           // IDEA encrypted
  209. #define fCompADPCM    512           // ADPCM compressed
  210. #define fEncPGP        1024          // PGP-protected session key encrypted
  211. #define fKeyPGP        2048          // Packet contains PGP-encrypted session key
  212. #define fCompLPC    4096          // LPC compressed
  213. #define fFaceData   8192          // Request/reply for face data
  214. #define fFaceOffer  16384         // Offer face image to remote host
  215.  
  216. // Special definitions for face data packets (which have fFaceData set)
  217.  
  218. #define faceRequest 1             // Face data request
  219. #define faceReply   2             // Face data reply
  220. #define faceLess    4             // No face available
  221.  
  222. // Mask to extract compression modes
  223.  
  224. #define fCompressionModes   (fComp2X | fCompGSM | fCompADPCM | fCompLPC)
  225.  
  226. /*    The following flags appear in the compression field of sound
  227.     buffers but never figure in buffers actually transmitted on
  228.     the network; they're used purely for internal housekeeping.
  229.     In some cases flags used in network buffers are reused.  */
  230.  
  231. #define fFromModem    0x8000          // From the modem
  232. #define fPlayback    0x80000000      // Answering machine playback packet
  233. #define fAnsNewMsg    0x40000000      // Start of new message on answering machine
  234.  
  235. // Test if a packet actually contains sound
  236.  
  237. #define isSoundPacket(c)    (((c) & (fFaceData | fKeyPGP)) == 0)
  238.  
  239. //    Answering machine file format
  240.  
  241. struct respHeader {
  242.     struct in_addr hostIPnumber;    // IP number of sending host
  243.     time_t itemTime;                // Time and date buffer received
  244.     short hostNameLength;            // Length of hostName including zero terminator
  245.     short soundBufLength;            // Length of sound buffer
  246.     
  247. /*    The following items appear in the file after the header defined
  248.     above, with lengths as given in the header.  */
  249.  
  250. //    char hostName[hostNameLength];    // Full name of host
  251. //    soundbuf fileSoundBuf;            // Sound buffer, truncated to soundBufLength bytes 
  252. };
  253.  
  254. //  Some useful types missing from 16-bit Windows
  255.  
  256. #ifndef WIN32
  257. typedef char CHAR;
  258. typedef int INT;
  259. typedef unsigned long ULONG;
  260. typedef ULONG *PULONG;
  261. typedef ULONG *LPULONG;
  262. #endif
  263.  
  264. //  Socket-specific types
  265.  
  266. typedef INT    SOCKERR;                    // A socket error code
  267. typedef WORD PORT;                       // A socket port number
  268. typedef WORD SOCKEVENT;                    // An asynchronous socket event
  269.  
  270. //  Potential states for connection windows
  271.  
  272. typedef enum _CLIENT_STATE
  273. {
  274.     Embryonic,                          // Newly creates connection
  275.     Idle,                               // Idle
  276.     SendingLiveAudio,                   // Sending live audio
  277.     Transferring,                       // Sending audio file
  278.     PlayingReceivedAudio                // Playing audio received from remote host
  279.  
  280. } CLIENT_STATE;
  281.  
  282. /*  Connection window data.  A pointer to this structure is
  283.     kept at offset GWL_CLIENT in each connection window. */
  284.  
  285. typedef struct _CLIENT_DATA {
  286.     DWORD dwType;                        // Type of window (WINDOW_TYPE_CLIENT)
  287.     CLIENT_STATE state;                 // Current state.
  288.     SOCKET sReply;                        // Socket waiting for reply from srv
  289.     int timeout;                           // Timeout counter
  290.     SOCKADDR_IN inetSock;                // Client's socket address
  291.     CHAR szHost[MAX_HOST];                // Target server's host name
  292.     HFILE hFile;                         // Handle to open file
  293.     DWORD cbSent;                        // Count of bytes sent so far.
  294.     DWORD cbReceived;                    // Count of bytes received so far
  295.     CHAR szFile[MAX_PATH];              // Name of file being sent
  296.     HANDLE getNameTask;                    // Get full site name task handle
  297.     BYTE hostBuffer[MAXGETHOSTSTRUCT];    // Host name reply buffer
  298.     
  299.     int modemConnection;                // Connection is via the modem
  300.     HMMIO mmioHandle;                    // WAVE file MMIO handle
  301.     LPWAVEFORMAT mmioFormat;            // WAVE file format descriptor
  302.     DWORD mmioDataLeft;                    // WAVE file data left to send
  303.     int quitSoundFile;                    // Abort current sound file ?
  304.     int wantsInput;                        // Is wave input wanted ?
  305.     int outputSocketBusy;                // Output socket is busy with a sendto()
  306.     DWORD broadcastBeginTime;            // Time (ticks) when subscribed to broadcast
  307.     int broadcastEnd;                    // Terminate broadcast connection ?
  308.     struct sockaddr_in name;            // Target system address
  309.     char desKeyString[256];                // DES key string
  310.     char deskey[9];                       // Destination DES key, if any
  311.     char ideaKeyString[256];            // IDEA key string
  312.     char ideakey[17];                     // Destination IDEA key, if any
  313.     char pgpkeymd5[16];                    // Inbound MD5 signature of PGP session key
  314.     char pgpkey[17];                    // Inbound PGP-transmitted session key
  315.     char pgpFileName[MAX_PATH];            // Inbound PGP decoded file name, if strlen > 0
  316.     char opgpUserList[256];                // Outbound PGP user ID list
  317.     char opgpkey[17];                    // Outbound PGP-transmitted session key
  318.     char opgpFileName[MAX_PATH];        // Outbound PGP decoded file name, if strlen > 0
  319.     char otpFileName[MAX_PATH];            // One-time pad file name
  320.     char otp[BUFL];                     // One-time pad
  321.     int multicast_scope;                // Multicast scope (time-to-live)
  322.     int squelch;                        // Squelch
  323.     int ring;                            // Ring
  324.     int debugging;                        // Debug mode
  325.     int debugReq;                        // Debug output requested by remote ?
  326.     int loopback;                        // Loopback mode
  327.     int saveKeys;                        // Save keys in connection file
  328.     char connectionFileName[MAX_PATH];    // Connection file name for save
  329.     gsm gsmh;                            // GSM handle
  330.     
  331.     int face_stat;                        // Face retrieval status
  332.     long face_address;                    // Address of current block request
  333.     int face_retry;                       // Timeout retry count
  334.     int face_timeout;                     // Timeout interval
  335.     LPSTR face_bmp;                        // In memory copy of face .bmp file
  336.     int face_shown;                        // Face bitmap currently displayed ?
  337.  
  338. } CLIENT_DATA, FAR *LPCLIENT_DATA;
  339.  
  340. #define CLIENTPTR(w)            ((LPCLIENT_DATA)GetWindowLong((w), GWL_CLIENT))
  341. #define IS_CLIENT_WINDOW(w)     (CLIENTPTR(w)->dwType == WINDOW_TYPE_CLIENT)
  342.  
  343. // Face retrieval status values for face_stat
  344.  
  345. #define FSinit      0                     // Nothing requested yet
  346. #define FSrequest   1                     // Request sent, awaiting reply
  347. #define FSreply     2                     // Reply received, ready for next request
  348. #define FScomplete  3                     // Face file reception complete
  349. #define FSabandoned 4                     // Face file retrieval abandoned
  350.  
  351. // Face retrieval configuration parameters
  352.  
  353. #define FaceFetchInterval   250            // Interval between block requests, msec
  354. #define FaceTimeout            20            // Resend block request after this number of intervals                                    
  355. #define FaceMaxRetries      10            // Maximum retries to obtain face data
  356.  
  357.  
  358. //  Socket related data
  359.  
  360. extern SOCKET sCommand;                            // Command socket
  361.  
  362. //  Various handles
  363.  
  364. extern HINSTANCE hInst;                            // The current instance handle
  365. extern HACCEL hAccel;                            // Accelerator table handle
  366. extern HWND hwndMDIFrame;                        // MDI frame  window handle
  367. extern HWND hwndMDIClient;                        // MDI client window handle
  368. extern HWND hDlgPropeller;                        // Propeller head dialogue handle
  369. extern FARPROC pfnPropeller;                    // Propeller head procedure instance
  370. extern HWND hDlgAnswer;                            // Answering machine dialogue handle
  371. extern FARPROC pfnAnswer;                        // Answering machine procedure instance
  372.  
  373. //  Window class names
  374.  
  375. extern LPSTR pszFrameClass;                        // MDI frame  window class
  376. extern LPSTR pszMDIClientClass;                    // MDI client window class
  377. extern LPSTR pszClientClass;                    // MDI child window class
  378.  
  379. //  Miscellaneous data
  380.  
  381. extern LPSTR pszAppName;                        // Application name
  382. extern INT tmAveCharWidth;                        // TEXTMETRIC.tmAveCharWidth
  383. extern INT tmHeight;                            // TEXTMETRIC.tmHeight
  384. extern LPSTR commandLine;                        // Command line from invocation
  385. extern int holped;                                // Help was invoked somewhere
  386. extern UINT fileOpenHelpButton;                    // File open help button message value
  387. extern char *fileHelpKey;                        // Help key for file open/save in progress
  388.  
  389. extern HWAVEOUT hWaveOut;                        // Wave output handle
  390. extern HWAVEIN hWaveIn;                          // Wave input handle
  391.  
  392. extern soundbuf ebuf;                            // Utility sound buffer
  393.  
  394. //    Compression modes
  395.  
  396. extern int compression;                            // 2X compression mode
  397. extern int gsmcompress;                            // GSM compression mode
  398. extern int adpcmcompress;                        // ADPCM compression mode
  399. extern int lpccompress;                            // LPC compression mode
  400. extern gsm gsmh;                                // GSM compression handle
  401. extern int currentInputSamples;                    // Samples desired in current input buffers
  402.  
  403. //    Transmission modes
  404.  
  405. extern int broadcasting;                        // Broadcasting to all connections ?
  406. extern int listeners;                            // Current wantsInput windows
  407.  
  408. //    Audio settings for About dialogue
  409.  
  410. extern int inputActive, outputActive;            // Current activity flags
  411. extern int halfDuplex;                          // Is hardware half-duplex
  412. extern int aboutInSamples;                        // Input samples per second
  413. extern int aboutInBits;                            // Input bits per sample
  414. extern int aboutOutSamples;                        // Output samples per second
  415. extern int aboutOutBits;                        // Output bits per sample 
  416.  
  417. //    Propeller head information
  418.  
  419. extern long packetsReceived, packetsSent;        // Network packet traffic counters
  420. extern long inputPacketsLost, outputPacketsLost;// Packets lost counters
  421. extern int openConnections;                        // Number of open connections
  422. extern int halfDuplexTransition;                // Transitioning from output to input ?
  423. extern int outputInShutdown;                    // Close output when last buffer returned
  424. extern long outputPending;                        // Output buffers in queue
  425. extern int messageQueueSize;                    // Message queue size
  426.  
  427. //    Network configuration for About dialogue
  428.  
  429. extern int aboutUDPmax;                         // Longest UDP packet network handles
  430. extern int netMaxSamples;                        // Maximum samples, possibly net constrained
  431.  
  432. //    Windows and driver bug work-around options
  433.  
  434. extern int alwaysBindSocket;                    // Bind output socket to avoid
  435.                                                 // bug in some WINSOCK implementations
  436. extern int useSendNotSendto;                    /* Use send() instead of sendto()
  437.                                                    if buggy (Microsoft) WINSOCK
  438.                                                    refuses to accept sendto() on
  439.                                                    a connect()-ed socket. */
  440. extern int waNetNoConnect;                        // Don't connect(), use sendto()
  441. extern int waNetUseSend;                        // Use send(), not sendto() always
  442. extern int waNetMultiTTLisChar;                    // Argument to IP_MULTICAST_TTL setsockopt is char
  443. extern int waAudioHalf;                            // Assume audio half-duplex; don't test
  444. extern int waAudio11025;                        // Assume audio 11025 samples/sec                                                
  445.  
  446. //    Modem configuration information
  447.  
  448. #define    modemInputQueue    10240
  449. #define modemOutputQueue 10240
  450.  
  451. extern int modemEnable;                            // Modem connections enabled ?
  452. extern char modemInitString[128];                // Modem initialisation string
  453. extern char baudrate[12];                        // Baud rate
  454. extern char commport[12];                        // Communications port
  455. extern int modemHandle;                            // Open modem comm port handle
  456. extern int modemSessions;                        // Open sessions on modem
  457. extern int modemShowRant;                        // Show rant about Windows serial I/O support
  458.  
  459. //    Remembered connections
  460.  
  461. extern int rememberedConnections;                // Number of remembered connections
  462. extern LPSTR rememberedConnection[REMEMBER_CONNECTIONS];  // Remembered connections
  463.  
  464. //    Multicast settings
  465.  
  466. extern int multiMemberships;                    // Number of multicast group memberships
  467. extern struct in_addr multiAddr[IP_MAX_MEMBERSHIPS]; // Multicast group IP numbers
  468. extern LPSTR multiName[IP_MAX_MEMBERSHIPS];        // Multicast group names
  469. extern int multiLoop;                            // Multicast loop-back mode
  470. extern int multiBrainDead;                        // Multicast loop-back option not supported
  471.  
  472. //    Answering machine
  473.  
  474. extern char answerFileName[MAX_PATH];            // Answering machine file name
  475. extern int answerRecord;                        // Record incoming messages
  476.  
  477. //    Show Your Face
  478.  
  479. extern char faceFileName[MAX_PATH];                // Face image file name
  480. extern HFILE faceFile;                             // Face image file handle
  481. extern int faceShow;                            // Show faces ?
  482.  
  483. //    Look Who's Listening
  484.  
  485. extern char lwl_s_server[MAX_PATH];                // Look Who's Listening server name
  486. extern char lwl_s_email[80];                    //        E-mail address
  487. extern char lwl_s_fullname[80];                    //        Full name
  488. extern char lwl_s_phone[80];                    //        Telephone number
  489. extern char lwl_s_location[80];                    //        Location name
  490. extern int lwl_s_publish;                        //        Publish in directory ?
  491. extern int lwl_s_exact;                            //        Exact match only ?
  492.  
  493. extern char lwl_a_server[MAX_PATH];                // Look Who's Listening query server
  494. extern int lwl_a_exact;                            //        Exact matches only
  495.  
  496. extern int lwl_t_published;                        // Directory listing published
  497. extern int lwl_t_resend;                        // Time to update directory listing ?
  498. extern struct sockaddr_in lookhost;               // Look who's listening host, if any
  499.  
  500. //    RTP communication state
  501.  
  502. extern unsigned long ssrc;                          // RTP synchronisation source identifier
  503. extern unsigned long timestamp;                   // RTP packet timestamp
  504. extern unsigned short seq;                          // RTP packet sequence number
  505. extern char *sdes;                                  // RTP SDES packet
  506. extern int sdesl;                                  // RTP SDES packet length    
  507.  
  508. extern HCURSOR phoneCursor, earCursor;            // Cursor handles
  509.  
  510. extern char blankit[];                          // Long string of blanks
  511.  
  512. #define V    (void)
  513.  
  514. #ifdef RANT_ON_ERROR
  515. #define errorRant(hwnd)    {if (modemShowRant) { modemRant(hwnd); } }
  516. #else
  517. #define errorRant(hwnd)
  518. #endif
  519.                                                         
  520. //    Function prototypes
  521.  
  522. extern void revlong(long FAR *l);
  523. extern void revshort(short FAR *s);                                                        
  524.  
  525. //    Connection window functions
  526.  
  527. extern LRESULT CALLBACK connectWndProc(HWND hwnd, UINT nMessage,
  528.                                 WPARAM wParam, LPARAM lParam);
  529. extern HWND createNewConnection(LPCLIENT_DATA pClientData);
  530. extern void connFetchFace(HWND hwndClient, LPCLIENT_DATA pClientData);
  531.  
  532. //  Dialogue functions
  533.  
  534. extern VOID aboutDialogue(HWND hwndParent);
  535. extern VOID propellerHeadDialogue(HWND hwndParent);
  536. extern BOOL CALLBACK propellerHeadDlgProc(HWND hwnd,
  537.                             UINT nMessage, WPARAM wParam, LPARAM lParam);
  538. extern void propUpdateAudio(void);                            
  539. extern BOOL newHostDialogue(HWND hwndParent, LPSTR pszHostName, LPIN_ADDR paddr);
  540. extern VOID genKeyDialogue(HWND hwnd);
  541. extern VOID connectionProperties(HWND hwnd, LPCLIENT_DATA d);
  542. extern VOID modemSetupDialogue(HWND hwnd);
  543. extern void modemRant(HWND hwnd);
  544. extern VOID multicastGroupsDialogue(HWND hwnd);
  545. extern VOID answerDialogue(HWND hwndParent);
  546. extern BOOL CALLBACK answerDlgProc(HWND hwnd, UINT nMessage,
  547.                             WPARAM wParam, LPARAM lParam);
  548. extern int faceDialogue(HWND hWndParent);                            
  549. extern BOOL CALLBACK faceDlgProc(HWND hwnd, UINT nMessage,
  550.                             WPARAM wParam, LPARAM lParam);                            
  551. extern VOID lwl_ask(HWND hwnd);
  552. extern VOID lwl_tell_settings(HWND hwnd);
  553.  
  554. //  Frame window functions
  555.  
  556. extern LRESULT CALLBACK Frame_WndProc(HWND hwnd, UINT nMessage, WPARAM wParam, LPARAM lParam);
  557.  
  558. //  Initialisation functions
  559.  
  560. extern BOOL InitApplication(HINSTANCE hInstance);
  561. extern BOOL InitInstance(HINSTANCE hInstance, LPSTR pszCmdLine, INT nCmdShow);
  562.  
  563. //    WAVE file I/O functions
  564.  
  565. extern int readWaveInit(HWND hwndApp, LPCLIENT_DATA d, LPSTR szFileName);
  566. extern int readWaveNext(HWND hwnd, LPCLIENT_DATA d);
  567. extern void readWaveTerm(LPCLIENT_DATA d);
  568.  
  569. //    CRC calculator functions
  570.  
  571. extern unsigned short crc(unsigned char __far *buff, int bufflen);
  572.  
  573. //    Modem driver functions
  574.  
  575. extern int openModem(HWND hwnd);
  576. extern int closeModem(HWND hwnd);
  577.  
  578. //    Answering machine functions
  579.  
  580. extern int answerOpen(void);
  581. extern void answerSave(struct in_addr IPaddr, LPSTR hostName, soundbuf *sb);
  582. extern void answerSync(void);
  583. extern void answerClose(void);
  584. extern int answerEnabled(void);
  585.  
  586. //    Show Your Face functions
  587.  
  588. extern void closeFaceFile(void);
  589. extern int openFaceFile(HWND hwnd);
  590. extern void processFaceRequest(soundbuf *d);
  591. extern void processFaceData(HWND hwnd, LPCLIENT_DATA c, soundbuf *d);
  592.  
  593. //    Look Who's Listening interface
  594.  
  595. extern int sendLwlMessage(HWND hDlg, int dobye);
  596. extern int lwl_reconnect(HWND hDlg);
  597.  
  598. //    RTP format functions
  599.  
  600. extern int rtp_make_sdes(char **pkt, unsigned long ssrc_i, int exact);
  601. extern int rtp_make_bye(char *p, unsigned long ssrc_i, char *raison);        
  602.  
  603. //  Utility functions
  604.  
  605. extern char *rstring(int resid);
  606. extern char *rfilter(int resid);
  607. extern INT MsgBox(HWND hwndParent, UINT fuType, LPSTR pszFormat, ...);
  608. extern VOID WinPrintf(HDC hdc, INT row, INT col, LPSTR pszFormat, ...);
  609. extern LPSTR SockerrToString(SOCKERR serr);
  610. extern SOCKERR ResetSocket(SOCKET sock);
  611. extern SOCKERR CreateSocket(SOCKET FAR * psock, INT type, ULONG address, PORT port);
  612. extern void playSound(HWND hWnd, LPCLIENT_DATA pClientData, soundbuf *d,
  613.                       int bitsPerSample, int samplesPerSecond);
  614. extern VOID newConnection(HWND hwnd, LPSTR connectionFile, LPSTR knownHost);                     
  615. extern void adpcmdecomp( struct soundbuf *sb);                      
  616. extern int startWaveInput(HWND hwnd);
  617. extern int inputSampleCount(void);
  618. extern void terminateWaveInput(void);
  619. extern void compress2X(soundbuf *asb);
  620. extern void createSoundBuffer(LPSTR buffer, WORD buflen, DWORD channels,
  621.                               DWORD rate, DWORD bytesec, WORD align);
  622. extern void shipSoundBuffer(HWND hwnd, LPCLIENT_DATA pClientData);                              
  623. extern VOID startSoundFile(HWND hwnd, LPSTR pszFile);
  624. extern void sessionKeyGenerate(LPSTR key, BOOL binary);
  625. extern int makeInternalEncryptionKeys(HWND hwnd, LPCLIENT_DATA d);
  626. extern void multicastJoin(HWND hwnd, int join);
  627. extern void propeller(int control, DWORD value);
  628. extern int obtainOutput(HWND hwnd);
  629.  
  630.  
  631.  
  632.  
  633.